package com.novelot.plugin.allinone;

import com.intellij.coverage.view.CoverageViewManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.novelot.plugin.allinone.stat.StatBean;
import com.novelot.plugin.allinone.stat.StatistView;
import com.novelot.plugin.allinone.switc.SwitchView;
import com.novelot.plugin.allinone.tinify.TinifyView;
import com.novelot.plugin.allinone.util.Logger;
import com.novelot.plugin.allinone.util.ShellUtils;

import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 *
 */
public class MyToolWindow {

    private JPanel mWindowContent;

    public MyToolWindow(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        mWindowContent = new JPanel();
        mWindowContent.setLayout(new GridBagLayout());

        JTabbedPane tabbedPane = new JTabbedPane();

        SwitchView switchView = new SwitchView(project);
        JPanel switchPanel = switchView.createSwitchView();
        tabbedPane.addTab("开关", switchPanel);

        StatistView statistView = new StatistView();
        JPanel statistPanel = statistView.createStatistView();
        tabbedPane.addTab("统计", statistPanel);

        TinifyView tinifyView = new TinifyView();
        tabbedPane.addTab("Tinify", tinifyView);

        GridBagConstraints tabbedPaneConstraints = new GridBagConstraints();
        tabbedPaneConstraints.gridx = 1;
        tabbedPaneConstraints.gridy = 1;
        tabbedPaneConstraints.gridwidth = 1;
        tabbedPaneConstraints.gridheight = 1;
        tabbedPaneConstraints.weightx = 1;
        tabbedPaneConstraints.weighty = 1;
        //tabbedPaneConstraints.insets = new Insets(8, 8, 8, 8);
        tabbedPaneConstraints.fill = GridBagConstraints.BOTH;
        mWindowContent.add(tabbedPane, tabbedPaneConstraints);

    }


    public JPanel getContent() {
        return mWindowContent;
    }


}
